﻿#!/usr/bin/env python

# ProjectHandler

from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext import db

from xml.dom.minidom import getDOMImplementation

class dbProject(db.Model):
	name = db.StringProperty(required=True)
	progress = db.IntegerProperty()
	

class ProjectHandler(webapp.RequestHandler):

    def get(self, ID):
		if (len(ID) == 0):
			project = dbProject(name="123")
			project.put()
			self.response.out.write(project.key())
			return
		
		impl = getDOMImplementation()
		newdoc = impl.createDocument(None, "some_tag", None)
		top_element = newdoc.documentElement
		text = newdoc.createTextNode('Some textual content.')
		top_element.appendChild(text)
		self.response.out.write(top_element.toxml())

    def post(self):
	    self.response.out.write('Hello world');